package Class;

import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;


public class CommonClassFile {

    public static CommonClassFile.CommonVariable commonVariable = new CommonClassFile.CommonVariable();
    public static CommonClassFile.HeapClass heapClassInst = new CommonClassFile.HeapClass();

    public static class CommonVariable {
        public int rg0 = 0;
        public double fg0 = 0.0;
        public int rg1 = 0;
        public static int heapNewPos = 512;
        public boolean abort = false;
        public boolean mandreelDisableSpaceKey = true;
        public String mandreelFatData = "";
        public String gMandreelWorkingFolder = "DataPC/";
        public int mandreelCurrentTime = 0;
        public ArrayList<Double> mandreelPauseTimes = new ArrayList<>();
        public double mandreelSampleTimeStart = 0.0;
        public String mandreelAudioDriver = "null";
        public String mandreelAppPlatform = "webgl";
        public int gAddrEmit = 0;
        public int mandreelSampintimeStart;
    }
    public static class HeapClass {
        public ByteBuffer heap;
        public byte[] heap8;
        public byte[] heapU8;
        public short[] heap16;
        public short[] heapU16;
        public int[] heap32;
        public int[] heapU32;
        public float[] heapFloat;
        public double[] heapDouble;
        public ByteBuffer myHeap;
        public ByteBuffer myHeap8;
        public IntBuffer myHeap32;

//        public void initHeap() {
//            heapClassInst.heap = ByteBuffer.allocateDirect(mandreelTotalMemory);
//            heapClassInst.heap8 = heapClassInst.heap;
//            heapClassInst.heapU8 = heapClassInst.heap;
//            heapClassInst.heap16 = heapClassInst.heap.asShortBuffer();
//            heapClassInst.heapU16 = heapClassInst.heap.asShortBuffer();
//            heapClassInst.heap32 = heapClassInst.heap.asIntBuffer();
//            heapClassInst.heapU32 = heapClassInst.heap.asIntBuffer();
//            heapClassInst.heapFloat = heapClassInst.heap.asFloatBuffer();
//            heapClassInst.heapDouble = heapClassInst.heap.asDoubleBuffer();

//        }
    }

    public void nullMandreelAudio(int sp) {
        commonVariable.rg0 = 0;
    }

    public void mandreelAudioUseMusicFunctions(int sp) {
        commonVariable.rg0 = 0;
    }
}


